﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace lucky_dog_backend.Models
{
    public abstract class AsyncDataFormat
    {
        [JsonProperty("code")]
        int Code;
        protected AsyncDataFormat(int code)
        {
            Code = code;
        }
    }
    public class AsyncDataSuccessWithoutData : AsyncDataFormat
    {
        public AsyncDataSuccessWithoutData() : base(0) { }
    }
    public class AsyncDataSuccessWithData<T> : AsyncDataFormat
    {
        [JsonProperty("data")]
        T Data;
        public AsyncDataSuccessWithData(T data) : base(1)
        {
            Data = data;
        }
    }
    public class AsyncDataFaild : AsyncDataFormat
    {
        [JsonProperty("msg")]
        string Msg;
        public AsyncDataFaild(string msg = "发生了一些错误") : base(-1)
        {
            Msg = msg;
        }
    }
}
